﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dycox.Reporting.Printing;

namespace Dycox.Windows.Forms
{
    public class PaperNotFoundHandler : IPaperNotFoundHandler
    {

        Form _form;
        
        public PaperNotFoundHandler(Form form)
        {
            if (form == null)
                throw new ArgumentNullException("form");
            _form = form;
        }

        void IPaperNotFoundHandler.OnPaperNotFound(ReportPrintDocument document, PaperNotFoundEventArgs e)
        {
            ConfirmPaperNotFoundDialog dlg = new ConfirmPaperNotFoundDialog(e);
            DialogResult dr = dlg.ShowDialog(_form);
            e.Retry = dr == DialogResult.Retry;
        }
    }
}
